package work3;

import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:work3/AspectByAnno.xml")
public class Test {
	
	@org.junit.Test
	public void t1() {
		ApplicationContext app=new ClassPathXmlApplicationContext("work3/ByProxyFactoryBean.xml");
		UserDaoImpl dao=(UserDaoImpl) app.getBean("userDaoImpl");
		dao.addUser();
	}
	@org.junit.Test
	public void t2() {
		ApplicationContext app=new ClassPathXmlApplicationContext("work3/AspectByXml.xml");
		UserDao dao=(UserDao) app.getBean("userDao");
		dao.addUser();
	}
	@Autowired
	UserDao userdao;
	@org.junit.Test
	public void t3() {
		userdao.addUser();
	}
}
